import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppService2 } from './app.service2';
import { DemoController } from './demo/demo.controller';
import { DemoModule } from './demo/demo.module';
import { UserModule } from './user/user.module';
import { ListModule } from './list/list.module';
import { ConfigModule } from './config/config.module';
import { UploadModule } from './upload/upload.module';

@Module({
  imports: [
    DemoModule,
    UserModule,
    ListModule,
    ConfigModule.forRoot({
      path: '/wzy',
    }),
    UploadModule,
  ],
  controllers: [AppController, DemoController],
  providers: [
    AppService2,
    {
      provide: 'ABC',
      useClass: AppService,
    },
    {
      provide: 'Test',
      useValue: ['pdd', 'taobao', 'JD'],
    },
    {
      provide: 'Test2',
      inject: [AppService2],
      async useFactory(AppService2: AppService2) {
        console.log(AppService2.getHello());
        return new Promise((r) => {
          setTimeout(() => {
            r(AppService2.getHello());
          }, 2000);
        });
      },
    },
  ],
})
export class AppModule {}
